package m.fun.action;

import m.base.action.BaseAction;
import m.common.action.ActionMeta;
import m.common.action.VueResult;
import m.common.model.util.QueryCondition;
import m.common.model.util.QueryOrder;
import m.fun.model.ProduceInGoods;
import m.html.VueListResult;

@ActionMeta(name = "fun/produceInGoods")
public class ProduceInGoodsAction extends BaseAction {

    /*
     * 生产商品列表
     */
    public VueResult recordList() throws Exception {
        VueListResult result=getVueListResult("生产商品", ProduceInGoods.class,actionUrl("recordList"));
        result.setHeight(-1);
        result.addCol(toIndexColumn());
        result.addCol(toTextColumn("仓库名称", "repository.name", 100, true));
        result.addCol(toTextColumn("商品名称", "goods.name", 150, true));
        result.addCol(toIntegerColumn("数量", "num", 100, true).setGroupTitle("入库"));
        result.addCol(toNumberColumn("单价", "price", 100, true).setGroupTitle("入库"));
        result.addCol(toNumberColumn("总优惠", "preferential", 100, true).setGroupTitle("入库"));
        result.addCol(toNumberColumn("金额", "amount", 100, true).setGroupTitle("优惠后"));
        result.addCol(toNumberColumn("单价", "preferentialPrice", 100, true).setGroupTitle("优惠后"));
        result.addCol(toTextColumn("备注", "remark", 100, true));
        //排序 result.addOrder
        //查询条件 result.addCondition
        result.addCondition(QueryCondition.eq("produce.oid",getParamsValue("produce.oid")));
        result.addOrder(QueryOrder.asc("oid"));
        return result;
    }
}
